// export const getItem = key => {
//   const data = localStorage.getItem(key)
//   try {
//     return JSON.parse(data)
//   } catch (err) {
//     return data
//   }
// }
// export const setItem = (key, val) => {
//   if (typeof val === 'object') {
//     val = JSON.stringify(val)
//   }
//   localStorage.setItem(key, val)
// }
// export const removeItem = key => {
//   localStorage.removeItem(key)
// }
export const getItem = key => {
  const data = localStorage.getItem(key)
  try {
    return JSON.parse(data)
  } catch (error) {
    return data
  }
}
export const setItem = (key, val) => {
  if (typeof val === 'object') {
    val = JSON.stringify(val)
  }
  localStorage.setItem(key, val)
}
export const removeItem = key => {
  localStorage.removeItem(key)
}
